python function that takes input as dictionary